package com.ea.eadp.nexus.test.workflow.newconsole;

import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;

import com.ea.eadp.nexus.test.pageDefinition.newconsole.UnderageOriginAccountPage;
import com.ea.eadp.nexus.test.workflow.WorkflowElement;
import com.ea.eadp.nexus.test.workflow.WorkflowElementArgument;

public class UnderageChooseLoginOrCreateWorkflowElement extends WorkflowElement {
    
    protected UnderageOriginAccountPage page;
    
    public static enum Choice {Login, Create};
    public Choice choice = Choice.Login;
    
    public UnderageChooseLoginOrCreateWorkflowElement(
        WebDriver driver, WorkflowElementArgument argument
    ) {
        super(driver, argument);
        page = new UnderageOriginAccountPage(driver);
    }
    
    @Override
    public void init() {
        page.waitPageLoadCompleted();
    }
    
    @Override
    public void moveNext() {
        if ( Choice.Create.equals(choice) ) {
            page.sendControllerKey(Keys.RIGHT);
        }
        page.sendControllerKey('A');
    }
    
}
